import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path'
import WindiCSS from 'vite-plugin-windicss'
// https://vitejs.dev/config/
import requireTransform from 'vite-plugin-require-transform';
export default defineConfig({
    resolve: {
        alias: {
            "~": path.resolve(__dirname, "src")
        },
    },
    server: {
        proxy: {
            '/api': {
                target: 'http://localhost:9081',
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, '')
            },
        }
    },
    plugins: [vue(), WindiCSS()],
    build: {
        chunkSizeWarningLimit: 1500,
        rollupOptions: {
            output: {
                manualChunks(id) {
                    if (id.includes('node_modules')) {
                        return id.toString().split('node_modules/')[1].split('/')[0].toString();
                    }
                }
            }
        }
    }
})